package com.fire.activiti.activitidb.process.adapter;


import org.activiti.engine.impl.cfg.IdGenerator;
import org.activiti.engine.impl.interceptor.CommandInterceptor;
import org.activiti.engine.impl.persistence.StrongUuidGenerator;
import org.activiti.spring.SpringProcessEngineConfiguration;

/**
 * @author Mr.Fire
 * @date 2021/12/21
 * @desc 流程配置
 */
public class ProcessConfig extends SpringProcessEngineConfiguration {

    private static final IdGenerator strongUuidGenerator = new StrongUuidGenerator();


    public ProcessConfig() {
        // id生成器
        this.idGenerator = strongUuidGenerator;
        // 默认不维护数据库，使用自定义数据库维护机制维护数据库，适配国产数据库
        this.databaseSchemaUpdate = DB_SCHEMA_UPDATE_FALSE;
        // 使用流程定义缓存
        this.enableProcessDefinitionInfoCache = true;
    }

    @Override
    public CommandInterceptor createTransactionInterceptor() {
        if (this.transactionManager == null)
            return null;
        return super.createTransactionInterceptor();
    }
}
